//: Playground - noun: a place where people can play

import UIKit

var hasIdCard : Bool = false
var hasMoney : Bool = false

func online(age : Int) {
    if age >= 18 {
        if hasIdCard {
            if hasMoney {
                print("可以去上网")
            }else {
                print("回家拿钱")
            }
        }else {
            print("回家拿身份证")
        }
    }
}

func online1(age : Int) {
    guard age >= 18 else {
        print("回家去")
        return
    }

    guard hasIdCard else {
        print("回家拿身份证")
        return
    }

    guard hasMoney else {
        print("回家拿钱")
        return
    }

}

online(age: 18)

online1(age: 19)